//
//  AppDelegate.swift
//  3-微博
//
//  Created by DDDD on 16/2/24.
//  Copyright © 2016年 gongsimingzi. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.
        window = UIWindow(frame: UIScreen.mainScreen().bounds)
        window?.makeKeyAndVisible()
        setApperace()
        print(WQCUserViewModel.userViewModel.isLogin)
        if WQCUserViewModel.userViewModel.isLogin{
            window?.rootViewController = WQCViewController()
        }else{
            window?.rootViewController = WQCWelcomController()
        }
//        window?.rootViewController = WQCWelcomController()
        NSNotificationCenter.defaultCenter().addObserver(self, selector:"ChangeRootVC", name:kNotificaionChangeRootVC, object: nil)
        
        return true
    }

    func setApperace(){
        UINavigationBar.appearance().tintColor = UIColor.orangeColor()
        UITabBar.appearance().tintColor = UIColor.orangeColor()
    }

    func ChangeRootVC(){
        window?.rootViewController = WQCViewController()
    }
    deinit {
        NSNotificationCenter.defaultCenter().removeObserver(self, name: kNotificaionChangeRootVC, object: nil)
    }
   
}

